﻿using System;
using UnityEngine;

// Token: 0x02000381 RID: 897
public class UVLerpManager
{
	// Token: 0x0600163B RID: 5691 RVA: 0x00094D98 File Offset: 0x00092F98
	public UVLerpManager(UVNormalBlend blend, UVData targetData)
	{
		this.targetData = targetData;
		for (int i = 0; i < targetData.data.Count; i++)
		{
			if (targetData.data[i].ObjectName == UVLerpManager.uvName[0])
			{
				this.idx_L_Min = i;
			}
			else if (targetData.data[i].ObjectName == UVLerpManager.uvName[1])
			{
				this.idx_R_Min = i;
			}
			else if (targetData.data[i].ObjectName == UVLerpManager.uvName[2])
			{
				this.idx_L_Max = i;
			}
			else if (targetData.data[i].ObjectName == UVLerpManager.uvName[3])
			{
				this.idx_R_Max = i;
			}
		}
		this.mesh_nipL = blend.GetClonedMesh(UVLerpManager.uvName[0]);
		this.mesh_nipR = blend.GetClonedMesh(UVLerpManager.uvName[1]);
	}

	// Token: 0x0600163C RID: 5692 RVA: 0x00094EBC File Offset: 0x000930BC
	public void Lerp(float rate)
	{
		UVData.Param param = this.targetData.data[this.idx_L_Min];
		UVData.Param param2 = this.targetData.data[this.idx_R_Min];
		UVData.Param param3 = this.targetData.data[this.idx_L_Max];
		UVData.Param param4 = this.targetData.data[this.idx_R_Max];
		Vector2[] array = new Vector2[param.UV.Count];
		for (int i = 0; i < array.Length; i++)
		{
			array[i] = Vector2.Lerp(param.UV[i], param3.UV[i], rate);
		}
		this.mesh_nipL.uv = array;
		Vector2[] array2 = new Vector2[param2.UV.Count];
		for (int j = 0; j < array2.Length; j++)
		{
			array2[j] = Vector2.Lerp(param2.UV[j], param4.UV[j], rate);
		}
		this.mesh_nipR.uv = array2;
	}

	// Token: 0x040019F0 RID: 6640
	private UVData targetData;

	// Token: 0x040019F1 RID: 6641
	private Mesh mesh_nipL;

	// Token: 0x040019F2 RID: 6642
	private Mesh mesh_nipR;

	// Token: 0x040019F3 RID: 6643
	private static readonly string[] uvName = new string[]
	{
		"cf_O_tikubiL_00",
		"cf_O_tikubiR_00",
		"cf_O_tikubiL_01",
		"cf_O_tikubiR_01"
	};

	// Token: 0x040019F4 RID: 6644
	private int idx_L_Min;

	// Token: 0x040019F5 RID: 6645
	private int idx_R_Min = 2;

	// Token: 0x040019F6 RID: 6646
	private int idx_L_Max = 1;

	// Token: 0x040019F7 RID: 6647
	private int idx_R_Max = 3;
}
